Perl6: A LISP for 2010?

Mark Leighton Fisher on 2006-03-10T17:40:27

LISP has a reputation as an elite but hard-to-read academic computer language. Perl is seen, meanwhile, as a working programmer's tool (the "Swiss Army tactical nuke" of legend). But even the current Perl5 possesses most of the qualities LISP programmers claim that makes LISP such a productive development environment.

Perl5 is an interpreted language with no lengthy edit-compile-link cycle, automatic storage management, untyped scalar variables, heterogeneous lists, introspection of objects and classes, map, anonymous functions, closures, eval, here-docs, etc. – the list goes on and on.

So what does LISP have that Perl5 lacks? IMHO, mainly some macro features. Source filters are limited, as they are not tightly integrated with the rest of Perl – think C #define rather than assembler macros. Perl6 rules look like the enabling mechanism for a whole host of new dialects for Perl, as rules (and their grammars) should make it considerably easier for ordinary mortals to add to and/or change the grammar of Perl. For the Perl community, rules may be as large an advance as YACC/Lex were for C programmers in their day. Rules might even be a larger advance than YACC/Lex, as rules are based on regexps, which are already in everyday use by Perl programmers (let's face it – how often do you use BNF in your daily coding?)

Perl is not LISP, though, nor will it ever be. The minimalist syntax of LISP S-expressions lends itself to an almost endless series of alterations (including, for what it's worth, multiple attempts to graft infix syntax onto LISP). For my taste, the syntactic sugar of Perl's infix notation tastes so much better than LISP's S-expressions (Larry's "LISP has all the visual appeal of oatmeal with fingernail clippings mixed in" comes to mind). Perl6 rules will greatly lower the bar to changing the language, but the bar will still be higher than LISP's bar due to LISP's use of S-expressions. For native Perl programmers, I don't think that the greater complexity of rules will be much of a bar to language experimentation, as rules are based on regexps – and regexps are an everyday tool for Perl programmers.

Perl6 looks to be an example of the 80/20 maxim – Perl6 will give you 80% (actually better) of LISP's power while Perl6 requires 20% of the effort to learn LISP (less for native Perl5 programmers). I have wondered, over the years, why I never seemed to bother to learn LISP, given the great esteem LISP holds in academic and research situations as well as the many claims of the high productivity resulting from LISP development environments. My recent LISP look-see leads me to believe that the Perl community has been leading me to LISP's power and expressiveness without my even noticing it – until now. My thanks to Larry, Damian, and the numerous others who have helped develop Perl to what it is today.

My sources for this essay include: